#pragma once
#ifndef _KH_ENGINE_RENDERVIEW_H
#define _KH_ENGINE_RENDERVIEW_H
#include <Kharlia/Engine/Common.h>
#include <Kharlia/Engine/Units.h>
#include <CEGUIWindowFactory.h>

namespace kharlia { namespace engine {

class ACamera;
class CClient;

class FRenderView: public ui::Window {
    TWeakPtr<CClient> mClient;
    bool mDrawEveryFrame;
    TWeakPtr<ACamera> mCamera;

public:
    FRenderView(ui::String const& type, ui::String const& name);

    // UI::Window interface
    void drawSelf(ui::RenderingContext const&);
    void onSized(ui::WindowEventArgs& e);

    void onMouseMove(ui::MouseEventArgs& e);
    void onMouseButtonUp(ui::MouseEventArgs& e);
    void onMouseButtonDown(ui::MouseEventArgs& e);
    void onKeyDown(ui::KeyEventArgs& e);
    void onKeyUp(ui::KeyEventArgs& e);

    TWeakPtr<CClient> const& GetWeakClient() const { return mClient; }
    void SetClient(TPtr<CClient> value) { mClient = value; }
    bool GetDrawEveryFrame() const { return mDrawEveryFrame; }
    void SetDrawEveryFrame(bool value) { mDrawEveryFrame = value; }
    TPtr<ACamera> GetCamera() const { return mCamera.Lock(); }
    void SetCamera(TPtr<ACamera> value) { mCamera = value; }

    static const ui::String WidgetTypeName;
    friend class CEngine;
};

}}

#endif